package com.rentong.wx.cust.controller;

import com.rentong.common.R;
import com.rentong.wx.cust.domain.CustFlowApplyEntity;
import com.rentong.wx.cust.service.CustFlowApplyService;
import com.rentong.wx.utils.WxApiUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zhangle
 * @email 459343178@qq.com
 * @date 2024-12-24 14:42:33
 */
@RestController
public class CustFlowApplyController {

    @Autowired
    private CustFlowApplyService custFlowApplyService;


    //100、获取用户提现信息
    @GetMapping("/custFlowApply/getUserFlowApplyInfo")
    public R getUserFlowApplyInfo(HttpServletRequest request) throws Exception {
        return R.success(custFlowApplyService.getUserFlowApplyInfo(WxApiUtil.getCurrentCustId(request)));
    }

    //101、提现
    @PostMapping("/custFlowApply/saveFlowApply")
    public R saveFlowApply(CustFlowApplyEntity flowApplyEntity, HttpServletRequest request) throws Exception {
        boolean result = custFlowApplyService.saveFlowApply(flowApplyEntity, WxApiUtil.getCurrentCustId(request));
        if (result) {
            return R.success();
        }
        return R.error("余额不足");
    }


}
